using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using mvLibrary.Helpers.Utils;

namespace fenk.Stock
{
    public partial class Movimientos : mvLibrary.BaseForm
    {
        public Movimientos()
        {
            InitializeComponent();
        }
        public override void BeforeSaveItem()
        {
            // guardar codigo usuario
            if (ItemStatus == Status.New)
            {
                UniItem.Replace(1, User);
            }
        }
        public override void AfterReadItem()
        {
            // no permite modificar registros ya autorizados
            if (ItemStatus == Status.Update)
            {
                if (UniItem.ExtractAsString(30) != string.Empty | UniItem.ExtractAsString(31) != string.Empty)
                {
                    CancelSaveItem = true;
                    ErrorMessage = "Registro ya controlado";
                    MessageBox.Show("Registro ya controlado");
                    panelData.Enabled = false;
                }
            }
        }
    }
}

